<?php
class DomArOneToManyTree extends DomArOneToMany {
	
	
	public function getLeftColumnName() {
		return $this->name.'_left';
	}
	
	public function getRightColumnName() {
		return $this->name.'_right';
	}
	
	public function getLevelColumnName() {
		return $this->name.'_level';
	}
	
	/**
	* @param DomArTable $table Parent table.
	*/
	public function alterTable( DomArTable $table ) {
		
		$table->changeColumn( $this->name, 'bigint', true );
		$table->changeColumn( $this->getRightColumnName(), 'bigint', true );
		$table->changeColumn( $this->getLeftColumnName(), 'bigint', true );
		$table->changeColumn( $this->getLevelColumnName(), 'bigint', false );
		
		$table->changeIndex( $table->tableName.'_'.$this->name, array($this->name,$this->getRightColumnName(),$this->getLeftColumnName(), $this->getLevelColumnName() ), 'index' );
		$table->changeIndex( $table->tableName.'_'.$this->getRightColumnName(), array($this->getRightColumnName()), 'index' );
		$table->changeIndex( $table->tableName.'_'.$this->getLeftColumnName(), array($this->getLeftColumnName()), 'index' );
			
		$childTable = call_user_func( array($this->childClassName, 'getTable') )->update();
	}
}
?>